In [2]:
HR_Coordinates = array([[423974, 6151447], [424033, 6150889], [424092, 6150332], [424151, 6149774], [424210, 6149216], [424268, 6148658], [424327, 6148101], [424386, 6147543], [424534, 6151447], [424593, 6150889], [424652, 6150332], [424711, 6149774], [424770, 6149216], [424829, 6148658], [424888, 6148101], [424947, 6147543], [425094, 6151447], [425153, 6150889], [425212, 6150332], [425271, 6149774], [425330, 6149216], [425389, 6148658], [425448, 6148101], [425507, 6147543], [425654, 6151447], [425713, 6150889], [425772, 6150332], [425831, 6149774], [425890, 6149216], [425950, 6148659], [426009, 6148101], [426068, 6147543], [426214, 6151447], [426273, 6150889], [426332, 6150332], [426392, 6149774], [426451, 6149216], [426510, 6148659], [426569, 6148101], [426628, 6147543], [426774, 6151447], [426833, 6150889], [426892, 6150332], [426952, 6149774], [427011, 6149216], [427070, 6148659], [427129, 6148101], [427189, 6147543], [427334, 6151447], [427393, 6150889], [427453, 6150332], [427512, 6149774], [427571, 6149216], [427631, 6148659], [427690, 6148101], [427749, 6147543], [427894, 6151447], [427953, 6150889], [428013, 6150332], [428072, 6149774], [428132, 6149216], [428191, 6148659], [428250, 6148101], [428310, 6147543], [428454, 6151447], [428513, 6150889], [428573, 6150332], [428632, 6149774], [428692, 6149216], [428751, 6148659], [428811, 6148101], [428870, 6147543], [429014, 6151447], [429074, 6150889], [429133, 6150332], [429193, 6149774], [429252, 6149216], [429312, 6148659], [429371, 6148101], [429431, 6147543]])
M2_Coordinates = array([423412, 6153342])
plot(HR_Coordinates[:,0], HR_Coordinates[:,1],'.')
plot(M2_Coordinates[0], M2_Coordinates[1],'o');
text(M2_Coordinates[0]+100, M2_Coordinates[1]+100,'M2');
$d_i = \sqrt{(x_i-x_{M2})^2 + (y_i-y_{M2})^2 }$
In [3]:
hr_rel_c = HR_Coordinates - M2_Coordinates
dist_m2 = array([sqrt(hr_rel_c[c,0]**2.0 + hr_rel_c[c,1]**2.0) for c in range(hr_rel_c.shape[0])]).reshape([10,8])
for r in range(8):
plot(dist_m2[:,r], 'x-', label='row %d'%r);
legend();
xlabel('Column number [-]');
ylabel('Distance from M2 [m]');
In [4]:
stdev = array(
[[2.8,2.4,3.1,3.0,3.6,3.5,3.6,3.7,3.7,3.9],
[3.1,3.2,3.1,3.2,3.3,3.6,3.7,3.7,3.8,4.1],
[2.9,2.9,3.3,5.5,0.0,3.7,3.7,3.9,4.1,4.2],
[3.2,3.4,3.6,3.4,3.9,3.8,5.9,3.7,4.1,4.4],
[3.8,3.6,3.7,3.9,3.0,3.7,4.1,4.1,4.3,4.7],
[6.1,3.6,3.8,3.9,4.0,4.1,4.2,4.4,4.4,4.8],
[4.2,3.9,4.3,4.0,4.8,4.4,4.3,4.4,4.6,4.7],
[4.2,4.3,4.4,4.4,4.5,4.7,4.7,4.6,5.1,4.9]]).T
In [5]:
x, y, z = HR_Coordinates[:,0], HR_Coordinates[:,1], stdev.flatten()
from mpl_toolkits.mplot3d import Axes3D
fig = figure()
ax = fig.add_subplot(111, projection='3d')
ax.bar3d(x, y, zeros([80]), 100*ones([80]), 100*ones([80]) , z, color='b', zsort='average')
ax.bar3d(M2_Coordinates[0], M2_Coordinates[1], 0, 100, 100 , 6, color='g', zsort='average')
Removing outliers: we filter out manually the stds that are higher than 5deg and lower than 1deg
In [6]:
xc = x[(z<5) & (z>1)]
yc = y[(z<5) & (z>1)]
zc = z[(z<5) & (z>1)]
distc = dist_m2.flatten()[(z<5) & (z>1)]
In [7]:
xi = np.linspace(min(x),max(x),100)
yi = np.linspace(min(y),max(y),200)
# grid the data.
zi = griddata(xc,yc,zc,xi,yi)
# contour the gridded data, plotting dots at the nonuniform data points.
CS = plt.contour(xi,yi,zi,15,linewidths=0.5,colors='k')
CS = plt.contourf(xi,yi,zi,15,cmap=plt.cm.rainbow,
vmax=abs(zi).max(), vmin=0)
plt.colorbar();
The wind direction uncertainty measured by the wind turbine yaw sensors is a function on distance. It includes both the yaw misalignement and the spatial variability of wind direction.
In [9]:
plot(dist_m2.flatten(), stdev.flatten(),'.', label='data')
### Function calculating the linear regression
def regress(dist, zo, text):
di = zip(dist, ones([len(dist)]))
w = linalg.lstsq(di, zo)[0]
xi = linspace(0,10000)
xo = 'bug'
line = w[0]*xi+w[1]/xo
plot(xi, line, '-', label=text+', y = %4.2e x + %4.2f'%(w[0], w[1]))
regress(distc, zc, 'Original')
regress(dist_m2.flatten(), stdev.flatten(), 'Filtered')
xlabel('Distance from M2 [m]');
ylabel('std(M2-NPM) [$^\circ$]');
legend(loc=3);
Finding the bugs!
In [12]:
%debug
In [8]:
z
Out[8]:
In [9]:
print ones([len(^dist_m2.flatten())])
In [ ]: